//
//  FMRemotePlayer.h
//  FMRemotePlayer
//
//  Created by appbanana on 2017/3/12.
//  Copyright © 2017年 appbanana. All rights reserved.
//

#import <Foundation/Foundation.h>

#define kRemotePlayerURLOrStateChangeNotification @"remotePlayerURLOrStateChangeNotification"


typedef NS_ENUM(NSInteger, FMRemoteAudioPlayerState) {
    FMRemoteAudioPlayerStateUnknown = 0,
    FMRemoteAudioPlayerStateLoading   = 1,
    FMRemoteAudioPlayerStatePlaying   = 2,
    FMRemoteAudioPlayerStateStopped   = 3,
    FMRemoteAudioPlayerStatePause     = 4,
    FMRemoteAudioPlayerStateFailed    = 5
};

@interface FMRemotePlayer : NSObject

/**倍速*/
@property (assign, nonatomic) float rate;

/**静音*/
@property (assign, nonatomic) BOOL muted;

/**音量*/
@property (assign, nonatomic) float volume;

/**当前播放的url*/
@property (nonatomic, weak, readonly) NSURL *currentURL;

/**当前播放时间*/
@property (assign, nonatomic, readonly) NSTimeInterval currentTime;

/**播放总时间*/
@property (assign, nonatomic, readonly) NSTimeInterval duration;

/**播放进度*/
@property (assign, nonatomic, readonly) float progress;

/**缓存加载进度*/
@property (assign, nonatomic, readonly) float loadProgress;

@property (assign, nonatomic, readonly) FMRemoteAudioPlayerState state;

@property (nonatomic, copy) void(^stateChangeBlock)(FMRemoteAudioPlayerState state);

@property (nonatomic, copy) void(^playEndBlock)();




+ (instancetype)shareInstance;

/*
 * 播放
 */
- (void)playWithUrl:(NSURL *)url isCache:(BOOL)isCache;

/*
 * 暂停
 */
- (void)pause;

/*
 * 继续
 */
- (void)resume;

/*
 * 停止
 */
- (void)stop;

/*
 * 快进15s
 */
- (void)seekWithTimeInterval:(NSTimeInterval)timeInterval;

/*
 * 拖拽播放进度
 */
- (void)seekToProgress:(float)progress;

@end
